<?php
require_once './TLSSigAPIv2.php';
if(!empty($_GET['user_id'])){
   $userid = trim($_GET['user_id']); 
}else{
   echo '参数有误';
}
$api = new \Tencent\TLSSigAPIv2( 1400794757, '5380a26375fd3114f90f5b48d69a1912f0e4bef16e26ee8d3abf6fd298d85f26');
$sig = $api->genUserSig($userid);
echo $sig;
die();














$init_time = 0;
$expire = 0;
$err_msg = '';
$ret = $api->verifySig( $sig, '682', $init_time, $expire, $err_msg );
if ( !$ret ) {
    echo $err_msg . '\n';
} else {
    echo "verify ok expire $expire init time $init_time\n";
}
$userbuf = '';
$ret = $api->verifySigWithUserBuf( $sig, '682', $init_time, $expire, $userbuf, $err_msg );
if ( !$ret ) {
    echo $err_msg . '\n';
} else {
    echo "verify ok expire $expire init time $init_time userbuf $userbuf\n";
}
$sig = $api->genPrivateMapKey( '682', 86400*180, 10000, 255 );
echo $sig . '\n';
$sig = $api->genPrivateMapKeyWithStringRoomID( '682', 86400*180, "aaa", 255 );
echo $sig . '\n';
$init_time = 0;
$expire = 0;
$err_msg = '';
$ret = $api->verifySig( $sig, '682', $init_time, $expire, $err_msg );
if ( !$ret ) {
    echo $err_msg . '\n';
} else {
    echo "verify ok expire $expire init time $init_time\n";
}
$userbuf = '';
$ret = $api->verifySigWithUserBuf( $sig, '682', $init_time, $expire, $userbuf, $err_msg );
if ( !$ret ) {
    echo $err_msg . '\n';
} else {
    echo "verify ok expire $expire init time $init_time userbuf $userbuf\n";
}